<template>
	<up-grid>
		<navigator url="/pages/schedule/index">
			<up-grid-item>
				<up-icon :custom-style="iconStyle" name="calendar" size="30" />
				<text>排班明细</text>
			</up-grid-item>
		</navigator>
		<!-- <navigator url="/pages/admin/schedule/index">
			<up-grid-item v-if="isManager === true">
				<up-icon :custom-style="iconStyle" name="list" size="30" />
				<text>排班管理</text>
			</up-grid-item>
		</navigator> -->
	</up-grid>
</template>

<script lang="ts" setup>
import { useUserStore } from "@/store/user";
import { storeToRefs } from "pinia";
import { onLoad, onPullDownRefresh } from "@dcloudio/uni-app";
import { isLogin, login } from "@/utils/login";

const userStore = useUserStore()
const { isManager } = storeToRefs(userStore)

const iconStyle = {
	paddingTop: "20rpx"
}


async function LoginFun() {
	const isLoginFlag = isLogin()
	console.log("------------")
	console.log(isLoginFlag)
	if (isLoginFlag) {
		console.debug("用户已登录")
	} else {
		console.debug("用户未登录")
		await login()
	}
}


onLoad(async () => {
	await LoginFun()
})

onPullDownRefresh(async () => {
	await LoginFun()
	uni.stopPullDownRefresh()
})
</script>

<style lang="scss" scoped>
.grid-text {
	text-align: center;
}
</style>